/***************************************************************************
 //* Foxit Software Inc.
 //* Copyright(C) 2005-2012, all rights reserved.
 //*
 //* The following code is copyrighted and contains proprietary information
 //* and trade secrets of Foxit Software Inc.                                                      *
 ***************************************************************************/
/**
 * PDF 签名 类
 */
define(function (require, exports, module) {
	var PDFSignature = require('./Signature.js');
	require('../Interface.js');
    var Interface = WebPDF.Interface;
    /**
     * Enum for supported signature type.
     * @enum
     * @private
     */
	WebPDF.PDFData.SignatureDocType = {
			Text:"text",
			Img:"img"
	};
	
	WebPDF.PDFData.BaseSignatureDoc = {
			Date:"date",
			Text:"text"
	};

	WebPDF.PDFData.SignatureDocDataJSONFormat = {
				signatureId:"sigId",
				posX:"x",
				posY:"y",
				originalImageWidth:"iw",
				originalImageHeight:"ih"
	};
	
	var SignatureDocDataJSONFormat = WebPDF.PDFData.SignatureDocDataJSONFormat;
    /**
     * @param jsonData
     * @constructor
     * @private
     */
    var PDFSignatureDoc = function (jsonData) {
    	PDFSignatureDoc.superclass.constructor.call(jsonData);
    	if(jsonData){
    		this.signature = jsonData;
    	}else{
    		this.signature = {};
    	}
    	
    	$.extend(this,{
    		/**
    		 * Get id of signature template
    		 * @returns {String} id of signature template
    		 */
    		getSignatureId:function(){
    			return this.signature[SignatureDocDataJSONFormat.signatureId];
    		},
    		/**
    		 * Set id of signature template
    		 * @param {String} signatureId id of signature template
    		 */
    		setSignatureId:function(signatureId){
    			this.signature[SignatureDocDataJSONFormat.signatureId] = signatureId;
    		},
    		/**
    		 * Get x coordinates of the upper-left
    		 * @returns {Number} x coordinates of the upper-left
    		 */
    		getPosX:function(){
    			return this.signature[SignatureDocDataJSONFormat.posX];
    		},
    		/**
    		 * Set x coordinates of the upper-left
    		 * @param {Number} posX x coordinates of the upper-left
    		 */
    		setPosX:function(posX){
    			this.signature[SignatureDocDataJSONFormat.posX] = posX;
    		},
    		/**
    		 * Get y coordinates of the upper-left
    		 * @returns {Number} y coordinates of the upper-left
    		 */
    		getPosY:function(){
    			return this.signature[SignatureDocDataJSONFormat.posY];
    		},
    		/**
    		 * Set y coordinates of the upper-left
    		 * @param {Number} posY y coordinates of the upper-left
    		 */
    		setPosY:function(posY){
    			this.signature[SignatureDocDataJSONFormat.posY] = posY;
    		},
    		/**
    		 * Get original width of image.
    		 * @returns {Number} original width of image.
    		 */
    		getOriginalImgWidth:function(){
    			return this.signature[SignatureDocDataJSONFormat.originalImageWidth];
    		},
    		/**
    		 * Set original width of image.
    		 * @param {Number} originalImageWidth original width of image.
    		 */
    		setOriginalImgWidth:function(originalImageWidth){
    			this.signature[SignatureDocDataJSONFormat.originalImageWidth] = originalImageWidth;
    		},
    		/**
    		 * Get original height of image.
    		 * @returns {Number} original height of image.
    		 */
    		getOriginalImgHeight:function(){
    			return this.signature[SignatureDocDataJSONFormat.originalImageHeight];
    		},
    		/**
    		 * Set original height of image.
    		 * @param {Number} originalImageWidth original height of image.
    		 */
    		setOriginalImgHeight:function(originalImageWidth){
    			this.signature[SignatureDocDataJSONFormat.originalImageHeight] = originalImageWidth;
    		}
    	});
    };
    
    Interface.extend(PDFSignatureDoc, PDFSignature);
    WebPDF.PDFData.PDFSignatureDoc = PDFSignatureDoc;
    return WebPDF.PDFData.PDFSignatureDoc;
});